#pragma once
#include "string"
#include "fstream"
#include "vector"
#include "map"
#include "windows.h"
#include "stack"
#include "typeinfo"
#include "algorithm"
using namespace std;

const static wchar_t wLeftBra = L'<';
const static wchar_t wRightBra = L'>';
const static wchar_t wWhiteSp = L' ';
const static wchar_t wTab = L'\t';
const static wchar_t wAsk = L'?';
const static wchar_t wQuote = L'\"';
const static wchar_t wSlash =  L'/';
const static wchar_t wNewLine = L'\n';
const static wchar_t wEqual = L'=';

enum ERROR_CODE{
	NOT_EXITST,
	SUCCEED,
	FORMAT_ERROR,
	ISNODE,
	ISCLOSETAG,
	ISELEMENT,
	NO_PARENT,
	NO_MATCH_TAG,
	ALREADY_EXIST
};

typedef map<wstring, wstring> ATTRIBUTES;

class XmlChild{
protected:
	wstring strName;
	ATTRIBUTES attributes;
public:
	void SetName(wstring _strName);

	wstring GetName();

	// Set the attributes of the "node"
	void SetAttr(ATTRIBUTES & attr);

	ERROR_CODE SetAttr(wstring strName, wstring strValue);

	ERROR_CODE AddAttr(wstring strName, wstring strValue);

	wstring GetAttribute(wstring strName);

	ERROR_CODE DelAttribute(wstring strName);

	virtual ~XmlChild();

	virtual void Output(wostream &out, int iIndent) = 0;
};
